package com.zhkj.txg.module.product.popup

import android.content.Context
import android.view.View
import android.view.animation.Animation
import com.zhkj.txg.R
import razerdp.basepopup.BasePopupWindow
import java.io.File

class SharePopupWindow(
    context: Context,
    val onShareCircle: (list: List<File>?) -> Unit
) : BasePopupWindow(context) {

    private var images: List<File>? = null

    init {
        setOutSideDismiss(false)
    }

    override fun onCreateContentView(): View = createPopupById(R.layout.popup_share)
    override fun onCreateShowAnimation(): Animation = getTranslateVerticalAnimation(1f, 0f, 300)
    override fun onCreateDismissAnimation(): Animation = getTranslateVerticalAnimation(0f, 1f, 300)

    override fun onViewCreated(contentView: View?) {
        contentView?.let {
            it.findViewById<View>(R.id.tvShareCircle).setOnClickListener { onShareCircle(images) }
            it.findViewById<View>(R.id.tvShareCancel).setOnClickListener { dismiss() }
        }
    }

    fun setData(list: List<File>) {
        this.images = list
    }
}